<%--
  Created by IntelliJ IDEA.
  User: 86137
  Date: 2022/3/20
  Time: 19:12
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>返回值问题</title>
    <script src="/js/jquery-1.11.1.js"></script>
</head>
<body>
<h3>-------test01--------${teamName}</h3>
<h3>-------test02--------${sessionScope.team.name}</h3>
</body>
<div>
    <button type="button" id="bn1">ajax请求自定义对象显示</button>
    <h3>显示该对象</h3>
    <p id="res1"></p>
    <button type="button" id="bn2">ajax请求list显示</button>
    <h3>显示list</h3>
    <p id="res2"></p>
    <button type="button" id="bn3">ajax请求map显示</button>
    <h3>显示map</h3>
    <p id="res3"></p>
</div>
<script>
    $(function (){
       $("#bn1").click(function (){
           $.ajax({
              type: "POST",
              url:"/result/test03-3",
              date:"",
              success: function (obj){
                 $("#res1").html(obj.id+","+obj.name+","+obj.location);
              }
           });
       }) ;
    });
    $(function (){
       $("#bn2").click(function(){
           $.ajax({
              type: "POST",
              url: "/result/test03-4",
              data: "",
              success: function (list){
                  var str = "";
                  for(var i=0;i<list.length;i++){
                      var obj = list[i];
                      str += obj.id+","+obj.name+","+obj.location+"<br/>";
                  }
                  $("#res2").html(str);
              }
           });
       });
    });
    $(function(){
       $("#bn3").click(function (){
            $.ajax({
               type: "POST",
               url: "/result/test03-5",
               data: "",
               success: function(map){
                   var str = "";
                   $.each(map,function (i,obj){
                      str += obj.id+","+obj.name+","+obj.location+"<br/>"
                   });
                   $("#res3").html(str);
               }
            });
       });
    });
</script>
</html>
